my $manifestTemplate = "AndroidManifest.xml";
my $cmd;
$cmd = 'perl -n -e "print $1 if(/versionCode=\\"(.+)\\"/);"';
my $versionCode = `$cmd $manifestTemplate`;
$cmd = 'perl -n -e "print $1 if(/versionName=\\"(.+)\\"/);"';
my $versionName = `$cmd $manifestTemplate`;
#my @marketNames = ("google", "appChina", "hiapk", "WAPS", "gfan", "meizu");
my @marketNames = ("google");
for my $market (@marketNames) {
  #print "Prepare for $market\n";
  #system("perl -p -e \"s/$placeHolder/$market/\" $manifestTemplate > AndroidManifest.xml");
  print "Building for $market\n";
  system("ant release");
  print "Post job for $market\n";
  system("cp bin/airreport-release.apk ../../releases/airreport-v$versionName-$versionCode-$market.apk");
}
